

<template>
  <a-modal width="800px" v-model:visible="visible" :footer="false" >
    <template #title>
      用户（{{userDataRef.data.id}}）- {{userDataRef.data.mobile}}
    </template>
    <a-descriptions :column="2" size="large" bordered  class="w-full">
        <a-descriptions-item label="账号">{{userDataRef.data.nickname}}</a-descriptions-item>
        <a-descriptions-item label="手机号">{{userDataRef.data.mobile}}</a-descriptions-item>

        <a-descriptions-item label="余额">{{userDataRef.data.account.balance}}</a-descriptions-item>
        <a-descriptions-item label="第二币余额">{{userDataRef.data.account.diamond_balance}}</a-descriptions-item>
        <a-descriptions-item label="总充值">{{userDataRef.data.account.pay_money}}</a-descriptions-item>
        <a-descriptions-item label="总提现">{{userDataRef.data.account.withdrawal_money}}</a-descriptions-item>
        <a-descriptions-item label="背包金额">{{userDataRef.data.bag_sum_price}}</a-descriptions-item>
        <a-descriptions-item label="赢亏">
          <a-tag >
            {{userDataRef.data.account.pay_money-userDataRef.data.account.balance-userDataRef.data.account.diamond_balance-userDataRef.data.account.withdrawal_money-userDataRef.data.bag_sum_price}}
          </a-tag>

        </a-descriptions-item>

      <a-descriptions-item label="首次充值时间">
        <span v-if="userDataRef.data.account.pay_start_time">
          {{tool.dateFormat(userDataRef.data.account.pay_start_time, 'yyyy-MM-dd hh:mm:ss', '-')}}
        </span>
      </a-descriptions-item>
      <a-descriptions-item label="最后充值时间">
         <span v-if="userDataRef.data.account.pay_end_time">
          {{tool.dateFormat(userDataRef.data.account.pay_end_time, 'yyyy-MM-dd hh:mm:ss', '-')}}
        </span>
      </a-descriptions-item>
      <a-descriptions-item label="密码">
        ******
        <a-button  v-auth="['user:info:resetPassword'] "@click="selectOperation('resetPassword',userDataRef.data.id)" > 初始化 </a-button>
      </a-descriptions-item>
      <a-descriptions-item label="部门">
        {{userDataRef.data.dept_list}}

      </a-descriptions-item>
      <a-descriptions-item label="推广人账号">
        {{userDataRef.data.parent_mobile?userDataRef.data.parent_mobile:'无'}}
        <a-button v-auth="['user:info:updateParent'] "@click="selectOperation('updateParent',userDataRef.data.id)" > 修改推广人 </a-button>
      </a-descriptions-item>
      <a-descriptions-item label="推广人类型">{{userDataRef.data.parent_is_flag?userDataRef.data.parent_is_flag:'无'}}</a-descriptions-item>
      <a-descriptions-item label="邀请码">{{userDataRef.data.invite_code}}</a-descriptions-item>
      <a-descriptions-item label="是否实名">
        <span v-if="userDataRef.data.is_real_name==1">已实名</span>
        <span v-if="userDataRef.data.is_real_name==2">未实名</span>

      </a-descriptions-item>

      <a-descriptions-item label="最后登陆ip">
        {{userDataRef.data.login_last_ip}}
        <a-button  v-auth="['user:info:clearLoginIp'] "@click="selectOperation('clearLoginIp',userDataRef.data.id)"> 清空 </a-button>
      </a-descriptions-item>
      <a-descriptions-item label="最后登陆时间">{{userDataRef.data.login_last_time}}</a-descriptions-item>

      <a-descriptions-item label="注册时间">{{userDataRef.data.create_time}}</a-descriptions-item>
      <a-descriptions-item label="用户类型">
        <span v-if="userDataRef.data.is_flag==1">普通用户</span>
        <span v-if="userDataRef.data.is_flag==2">测试用户</span>
      </a-descriptions-item>

      <a-descriptions-item label="用户状态">
        　<a-tag color="green" v-if="userDataRef.data.status==1">正常</a-tag>
        　<a-tag color="cyan" v-if="userDataRef.data.status==2">禁用</a-tag>
        　<a-tag color="red" v-if="userDataRef.data.status==3">冻结</a-tag>
     </a-descriptions-item>
      <a-descriptions-item label="是否在黑名单">
        <span v-if="userDataRef.data.back_is_exits">是</span>
        <span v-if="!userDataRef.data.back_is_exits">否</span>
      </a-descriptions-item>
      <a-descriptions-item label="操作">
        <a-space size="large">
          <a-button-group type="primary">
            <a-button > 查看背包</a-button>
            <a-button> 支付订单</a-button>
            <a-button > 充值 </a-button>
            <a-button> 修改黑名单 </a-button>
            <a-button>修改状态 </a-button>
            <a-button>余额变动日志</a-button>
          </a-button-group>
        </a-space>
      </a-descriptions-item>
    </a-descriptions>



  </a-modal>
</template>


<script setup>
import {onMounted, reactive, ref} from 'vue'
import userInfo from "@/api/user/userInfo";
import tool from '@/utils/tool'
const visible = ref(false)
const roomNo = ref('123131')
const userDataRef=reactive({data:{account:{}}})
const open = async (userId) => {
  const response = await userInfo.read(userId)
  userDataRef.data=response.data
  visible.value = true
}

const selectOperation = (value, id) => {

}
//----选择框变化
defineExpose({open})
</script>

<style scoped>





</style>